<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>refs 字符串形式</title>
    <style>
        #result{
            width: 400px;
            height: 300px;
            border:solid 1px #999;
        }
    </style>
</head>
<body>
    <div id="root"> </div>

    <script src="../js/react.development.js"></script>
    <script src="../js/react-dom.development.js"></script>
    <script src="../js/babel.min.js"></script>

    <script type="text/babel">
        class App extends React.Component{

            show = () => {
                //1. 获取 input 输入的内容
                let v = this.input.value;
                //2. 设置
                this.result.innerHTML = v;
            }

            render(){
                return <div>
                        <input type="text" ref={el => {
                            this.input = el;
                        }}/> <button onClick={this.show}>显示</button>
                        <hr />
                        <div id="result" ref={ el => this.result = el }></div>
                    </div>
            }
        }

        ReactDOM.render(<App />, document.querySelector("#root"));

    </script>
</body>
</html>